//
//  ProfileMobileViewController.m
//  GuoBuJiaForIphone
//
//  Created by zhangwo on 16/11/15.
//  Copyright © 2016年 GuoBuJia. All rights reserved.
//

#import "ProfileMobileViewController.h"

@interface ProfileMobileViewController ()

@end

@implementation ProfileMobileViewController
@synthesize tableView = _tableView;

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setTitle:@"修改手机号"];
    
    [self.view setBackgroundColor:[UIColor whiteColor]];
    self.navigationItem.leftBarButtonItem = [DSXUI barButtonWithStyle:DSXBarButtonStyleBack target:self action:@selector(back)];
    
    _tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    [self.view addSubview:_tableView];
    
    [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"phoneCell"];
    
    _mobileField = [self textFieldWithPlaceHolder:@"请输入原手机号"];
    _mobileField.text = [BJUserStatus sharedStatus].mobile;
    
    _seccodeField = [self textFieldWithPlaceHolder:@"请输入验证码"];
    
    [_seccodeField sizeThatFits:CGSizeMake(100, 40)];
    
    _secButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 100, 40)];
    _secButton.layer.masksToBounds = YES;
    _secButton.titleLabel.font = [UIFont systemFontOfSize:14.0];
    [_secButton setBackgroundImage:[UIImage imageNamed:@"icon-verificationCode"] forState:UIControlStateNormal];
    [_secButton setTitle:@"发送验证码" forState:UIControlStateNormal];
    [_secButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    
    _mobilenewField = [self textFieldWithPlaceHolder:@"请输入新号码"];
    
    UIView *footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SWIDTH, 100)];
    UIButton *submitButton = [[UIButton alloc] initWithFrame:CGRectMake(10, 40, SWIDTH-20, 40)];
    submitButton.layer.cornerRadius = 20.0;
    submitButton.layer.masksToBounds = YES;
    [submitButton setTitle:@"保存" forState:UIControlStateNormal];
    [submitButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [submitButton setBackgroundImage:[UIImage imageNamed:@"icon-preservation.png"] forState:UIControlStateNormal];
//    [submitButton addTarget:self action:@selector(submit) forControlEvents:UIControlEventTouchUpInside];
    [footerView addSubview:submitButton];
    _tableView.tableFooterView = footerView;
    
}

- (void)back{
    [self.navigationController popViewControllerAnimated:YES];
}

- (UITextField *)textFieldWithPlaceHolder:(NSString *)placeHolder{
    UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(10, 0, SWIDTH-20, 40)];
    textField.font = [UIFont systemFontOfSize:16.0];
    textField.clearButtonMode = UITextFieldViewModeWhileEditing;
    textField.placeholder = placeHolder;//提示语句
    return textField;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 50;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"phoneCell" forIndexPath:indexPath];
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0.001;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 0.001;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
